﻿CREATE TABLE [dbo].[RoleUser]
(
	[Id] INT NOT NULL PRIMARY KEY Identity, 
    [RoleId] INT NOT NULL, 
    [UserId] UNIQUEIDENTIFIER NOT NULL, 
    [DateCreated] DATETIME NOT NULL, 
    [CreatedBy] UNIQUEIDENTIFIER NOT NULL, 
    [IsDeleted] BIT NOT NULL DEFAULT 0, 
    CONSTRAINT [FK_RoleUser_ToRole] FOREIGN KEY (RoleId) REFERENCES [Role]([RoleId]), 
    CONSTRAINT [FK_RoleUser_ToUser] FOREIGN KEY (UserId) REFERENCES [User]([UserId]), 
    CONSTRAINT [FK_RoleUser_ToUserCreated] FOREIGN KEY ([CreatedBy]) REFERENCES [User]([UserId])
)
